package cn.maxmc.murderaddons.command

import cn.maxmc.murderaddons.machine.BaseMachine
import cn.maxmc.murderaddons.task.ArenaTask
import cn.maxmc.murderaddons.task.ArenaTaskManager
import org.bukkit.Location
import org.bukkit.entity.Player
import plugily.projects.murdermystery.arena.Arena

class ArenaTaskEditor(val player: Player, val arena: Arena) {
    val task: ArenaTask = ArenaTaskManager.tasksCache[arena] ?: ArenaTask(arena, ArrayList()).also { ArenaTaskManager.addTask(it) }

    var mainLocation: Location? = null

    var locations = ArrayList<Location>()

    fun addMachine(machine: BaseMachine) {
        task.machines.add(machine)
    }

    fun save() {
        ArenaTaskManager.saveTask(task)
    }

    fun reset() {
        mainLocation = null
        locations.clear()
    }
}